#include "verilated.h"
#include "verilated_fst_c.h"
#include "obj_dir/Vkeyboard_sim.h"

VerilatedContext* contextp = NULL;
VerilatedFstC* tfp = NULL;

static Vkeyboard_sim* top;

void step_and_dump_wave(){
  top->eval();
  contextp->timeInc(1);
tfp->dump(contextp->time());
}
void sim_init(){
  contextp = new VerilatedContext;
  tfp = new VerilatedFstC;
  top = new Vkeyboard_sim;
  contextp->traceEverOn(true);
  top->trace(tfp, 0);
  tfp->open("keyboard.fst");
}

void sim_exit(){
  step_and_dump_wave();
  tfp->close();
}

int main(int argc, char** argv) {
  sim_init();
  contextp->commandArgs(argc, argv);
  Verilated::mkdir("logs");
  for(int i=0; i<1000000;i++) step_and_dump_wave();
  sim_exit();
  delete contextp;
  return 0;
}
